/* @(#)GSOrderSubmitQuery.java    
 *
 * Project: GS
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   Jenny Li     2006-2-15    新增
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.action;

import java.util.ArrayList;

import system.LoginContext;

import com.hitrust.gs.business.GSOrderProcesser;
import com.hitrust.gs.business.GSUniteGwProcessor;
import com.hitrust.gs.business.GSUserProcessor;
import com.hitrust.gs.form.GSOrderSubmitForm;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;
import com.hitrust.gs.util.page.ResultProcess;
import com.hitrust.gs.vo.GSOrderSubmitVO;

/**
 * 订单提交查询
 */
public class GSOrderSubmitQueryAction extends GSBaseAction {

    
    public String execute(GSBaseForm aForm) throws Exception {
        
        GSOrderSubmitForm tForm = (GSOrderSubmitForm)aForm;
        //取得页面参数
        GSOrderSubmitVO tOrderSubmitVO = new GSOrderSubmitVO();
        tOrderSubmitVO.orderid = tForm.orderId;
        tOrderSubmitVO.orderDeptId = tForm.orderDept;
        tOrderSubmitVO.manufInfo = tForm.manufInfo;
        tOrderSubmitVO.concentricityId = tForm.concentricityId;
        tOrderSubmitVO.orderCreateDateStr = tForm.orderCreateDateStr;
        tOrderSubmitVO.orderCreateDateEnd = tForm.orderCreateDateEnd;
        tOrderSubmitVO.drawingpiececode = tForm.getDrawingpiececode();
        tOrderSubmitVO.createUserCode = tForm.getCreateUserCode();
        
        try{
            //取得当前操作员信息
            LoginContext tOperBean = (LoginContext)aForm.getSession().getAttribute(GSBaseConstants.LOGIN);
            //查询当前操作员所能操作订货单位的所有送货地址
            GSUniteGwProcessor processer = new GSUniteGwProcessor();
            ArrayList ary = processer.getWareHouseLevelName(tOperBean.getLoginWarehouseCode(),tOperBean.getLoginWarehouseCode());
            aForm.getRequest().setAttribute("organdaddr", ary);
            //查询当前操作员所能操作的订货单位
            GSOrderProcesser tProc = new GSOrderProcesser();
            ArrayList tList = tProc.getSubmitOrderAndDetailAndProviderNameAndUserId(tOrderSubmitVO);
            ResultProcess tRsProc = new ResultProcess();
            tRsProc.setResult(tList);
            tForm.getRequest().setAttribute("order",tRsProc);
            GSUserProcessor processerUser = new GSUserProcessor();
            ArrayList createUserList = processerUser.findUserByWarehouseCode(tOperBean.getLoginWarehouseCode());
            aForm.getRequest().setAttribute("userList", createUserList);
        }catch(Exception e){
            tForm.getRequest().setAttribute("action","A100301.do"); 
            throw e;
        }
        return GSBaseConstants.FORWARD_SUCCESS;
    }

}
